/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package de.hwrberlin.remo.model.impl;

import de.hwrberlin.remo.model.*;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;

import org.eclipse.emf.ecore.impl.EFactoryImpl;

import org.eclipse.emf.ecore.plugin.EcorePlugin;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Factory</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class RemoModelFactoryImpl extends EFactoryImpl implements RemoModelFactory {
	/**
	 * Creates the default factory implementation.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static RemoModelFactory init() {
		try {
			RemoModelFactory theRemoModelFactory = (RemoModelFactory)EPackage.Registry.INSTANCE.getEFactory(RemoModelPackage.eNS_URI);
			if (theRemoModelFactory != null) {
				return theRemoModelFactory;
			}
		}
		catch (Exception exception) {
			EcorePlugin.INSTANCE.log(exception);
		}
		return new RemoModelFactoryImpl();
	}

	/**
	 * Creates an instance of the factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public RemoModelFactoryImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public EObject create(EClass eClass) {
		switch (eClass.getClassifierID()) {
			case RemoModelPackage.KNOWLEDGE_BASE: return createKnowledgeBase();
			case RemoModelPackage.BOOLEAN_FACT: return createBooleanFact();
			case RemoModelPackage.LINKS_FROM_RULES: return createLinksFromRules();
			case RemoModelPackage.AND_RULE: return createAndRule();
			case RemoModelPackage.OR_RULE: return createOrRule();
			case RemoModelPackage.IMPLICATION: return createImplication();
			case RemoModelPackage.LINKS_FROM_FACTS: return createLinksFromFacts();
			case RemoModelPackage.LINK_OBJECT: return createLinkObject();
			default:
				throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object createFromString(EDataType eDataType, String initialValue) {
		switch (eDataType.getClassifierID()) {
			case RemoModelPackage.ELEMENT_STATE:
				return createElementStateFromString(eDataType, initialValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String convertToString(EDataType eDataType, Object instanceValue) {
		switch (eDataType.getClassifierID()) {
			case RemoModelPackage.ELEMENT_STATE:
				return convertElementStateToString(eDataType, instanceValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public KnowledgeBase createKnowledgeBase() {
		KnowledgeBaseImpl knowledgeBase = new KnowledgeBaseImpl();
		return knowledgeBase;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public BooleanFact createBooleanFact() {
		BooleanFactImpl booleanFact = new BooleanFactImpl();
		return booleanFact;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public LinksFromRules createLinksFromRules() {
		LinksFromRulesImpl linksFromRules = new LinksFromRulesImpl();
		return linksFromRules;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public AndRule createAndRule() {
		AndRuleImpl andRule = new AndRuleImpl();
		return andRule;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public OrRule createOrRule() {
		OrRuleImpl orRule = new OrRuleImpl();
		return orRule;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Implication createImplication() {
		ImplicationImpl implication = new ImplicationImpl();
		return implication;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public LinksFromFacts createLinksFromFacts() {
		LinksFromFactsImpl linksFromFacts = new LinksFromFactsImpl();
		return linksFromFacts;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public LinkObject createLinkObject() {
		LinkObjectImpl linkObject = new LinkObjectImpl();
		return linkObject;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ElementState createElementStateFromString(EDataType eDataType, String initialValue) {
		ElementState result = ElementState.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertElementStateToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public RemoModelPackage getRemoModelPackage() {
		return (RemoModelPackage)getEPackage();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @deprecated
	 * @generated
	 */
	@Deprecated
	public static RemoModelPackage getPackage() {
		return RemoModelPackage.eINSTANCE;
	}

} //RemoModelFactoryImpl
